package net.util;

import java.util.Collection;
import java.util.Iterator;

/**
 * 
 * @author paul
 *
 */
public class Debug {
	static private boolean	is_debug	= true;
	
	static public void println(){
		print( "\n" );
	}
	
	static public void println( Object o ){
		print( o + "\n" );
	}
	
	static public void print( Object o ){
		if ( is_debug )
			System.out.print( o.toString() );
	}

	static public void printCollection(Collection objects, int numberOfElementInOneLine, String endLine ){		
		int i = 0;
		
		println("{------------------");
		for (Object object : objects){
			i++;
			print(object + endLine);
			if (i%numberOfElementInOneLine==0)	
				print("\n");
		}
		println();
		println("------------------}");
	}
	
	static public void printIntArray( int[] intArray ){
		for ( int i = 0; i < intArray.length; i++ ){
			print( intArray[i] + ", ");
		}
		println();
	}
	/**
	 * Default number of elements in one line is 5.
	 * @param objects
	 */
	static public void printCollection(Collection objects){		
		printCollection(objects, 5, ",");
	}
	
	static public void printlnCollection(Collection objects, int numberOfElementInOneLine){
		printCollection(objects, numberOfElementInOneLine, "\n");
	}
	
	static public void printlnCollection(Collection objects){
		printCollection(objects, 5, "\n");
	}
	
	static public void exit(int systemSignal){
		System.exit(systemSignal);
	}
	
	static public void exit(){
		System.exit(0);
	}
}
